<?php
/*
 * Created on 2011-5-14
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
function getProviders(){
	$build = array();
	$query = db_select('node', 'n')->extend('PagerDefault');
	
	$nids = $query->fields('n', array('nid', 'sticky', 'created'))
	       ->condition('type', 'provider')
	       ->condition('status', 1)
	       ->orderBy('sticky', 'DESC')
	       ->orderBy('created', 'DESC')
	       ->limit(variable_get('default_nodes_main', 10))
	       ->addTag('node_access')
	       ->execute()
	       ->fetchCol();
    
    $nodes = node_load_multiple($nids);
    $build += node_view_multiple($nodes);
    $build['pager'] = array(
    	'#theme' => 'pager',
    	'#weight' => 5
    );
    return $build;
}